package com.zhaoxi.project.hrp.service;

import com.zhaoxi.framework.web.PageData;
import com.zhaoxi.framework.web.BaseService;
import com.zhaoxi.project.hrp.mapper.LeadMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

//样例
@Service
public class LeadService extends BaseService {
  @Autowired
  private LeadMapper leadMapper;
  //查询数据集合
  public List<PageData> getList(PageData pd) {
    return leadMapper.getList(pd);
  }
  //查询数据行数
  public PageData getCount(PageData pd) {
    PageData res = new PageData();
    return this.success(leadMapper.getCount(pd));
  }
  //新增
  public PageData add(PageData pd) {
    PageData res = new PageData();
    return this.success(leadMapper.add(pd));
  }
  //更新
  @Transactional
  public PageData edit(PageData pd) {
    PageData res = new PageData();
    this.addComment(pd);
    return this.success(leadMapper.edit(pd));
  }

  //删除
  public PageData del(Long id) {
    PageData res = new PageData();
    return this.success(leadMapper.del(id));
  }

//=============线索跟踪记录表==========
  //查询数据集合
  public List<PageData> getCommentList(PageData pd) {
    return leadMapper.getCommentList(pd);
  }

  //新增
  public PageData addComment(PageData pd) {
    return this.success(leadMapper.addComment(pd));
  }
}
